﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using KCL.Code;
using KCL.Code.Business;

namespace KCL.Components
{
    public partial class uscMake : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            btnAddMake.Enabled = dgvMake.Columns[2].Visible = (bool)Session[SessionManager.canCreate];
            dgvMake.Columns[1].Visible = (bool)Session[SessionManager.canModify];
        }

        protected void btnAddMake_Click(object sender, EventArgs e)
        {
            if (txtMakeName.Text.Trim().Length > 0)
            {
                MadeIn m = new MadeIn();
                m.name = txtMakeName.Text.Trim();
                m.isActive = true;
                MakeServices.Insert(m);
                dgvMake.DataBind();
                dgvMake.PageIndex = dgvMake.PageCount - 1;
            }
        }
    }
}